﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data.Mapping {
    public partial class CardApplyMap : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<CardApply> {
        public CardApplyMap() {
            ToTable("mc_CardApply", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.OrderNo)
                .HasColumnName("OrderNo")
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.BindId)
                .HasColumnName("BindId")
                .IsOptional();
            Property(t => t.OrderTime)
                .HasColumnName("OrderTime")
                .IsRequired();
            Property(t => t.Status)
                .HasColumnName("Status")
                .IsRequired();
            Property(t => t.PayId)
                .HasColumnName("PayId")
                .IsOptional();
            Property(t => t.Notify)
                .HasColumnName("Notify")
                .IsRequired();
            Property(t => t.SearchUrl)
                .HasColumnName("SearchUrl")
                .IsOptional();
            Property(t => t.Name)
                .HasColumnName("Name")
                .IsRequired();
            Property(t => t.IdCard)
                .HasColumnName("IdCard")
                .IsOptional();
            Property(t => t.BankName)
                .HasColumnName("BankName")
                .IsOptional();
            Property(t => t.Mobile)
                .HasColumnName("Mobile")
                .IsOptional();
            Property(t => t.Profit)
                .HasColumnName("Profit")
                .IsOptional();
     


            // Relationships
            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
            HasOptional(t => t.Binder)
                .WithMany()
                .HasForeignKey(d => d.BindId)
                .WillCascadeOnDelete(false);
            HasRequired(t => t.PayInfo)
                .WithMany()
                .HasForeignKey(d => d.PayId)
                .WillCascadeOnDelete(false);
        }
    }
}
